package com.yidu.ruifeng_logistics;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: 肖楚科
 * @date: 2021/3/3
 * @time: 15:39
 * @blog: com.yidu.springbootdemo
 * @description: 上传文件的配置
 */
@Configuration
public class UploadConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //前面是url访问的路径，后面是图片实际存在的路径
        registry.addResourceHandler("/img/**")
                .addResourceLocations("file:D://otherfiles//upload//");
        registry.addResourceHandler("/mp4/**")
                .addResourceLocations("file:D://otherfiles//video//");

    }
}

